import { RouteRecordRaw } from "vue-router";

import UserLayout from "@/layout/UserLayout.vue";
import UserRegisterPage from "@/views/user/UserRegisterPage.vue";
import UserLoginPage from "@/views/user/UserLoginPage.vue";
import HomePage from "@/views/HomePage.vue";
import ACCESS_ENUM from "@/access/accessEnum";
import MovieDetailPage from "@/views/movie/MovieDetailPage.vue";
import TheaterDetailPage from "@/views/theater/TheaterDetailPage.vue";
import TheaterPage from "@/views/theater/TheaterPage.vue";
import AddMovieOrderPage from "@/views/movieOrder/AddMovieOrderPage.vue";
import MovieOrderDetailPage from "@/views/movieOrder/MovieOrderDetailPage.vue";
import AdminMovieOrderPage from "@/views/movieOrder/AdminMovieOrderPage.vue";
import TheaterQueryPage from "@/views/theater/TheaterQueryPage.vue";

import HotMoviePage from "@/views/movie/HotMoviePage.vue";
import AddMoviePage from "@/views/add/AddMoviePage.vue";
import AdminMoviePage from "@/views/admin/AdminMoviePage.vue";
import AddTheaterPage from "@/views/add/AddTheaterPage.vue";
import AdminMovieTheaterPage from "@/views/admin/AdminMovieTheaterPage.vue";
import AddMovieShowPage from "@/views/add/AddMovieShowPage.vue";
import AdminMovieShowPage from "@/views/admin/AdminMovieShowPage.vue";
import AddUserPage from "@/views/add/AddUserPage.vue";
import AdminUserPage from "@/views/admin/AdminUserPage.vue";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "home",
    component: HomePage,
  },
  {
    path: "/movie/detail/:id",
    name: "电影详情页",
    props: true,
    component: MovieDetailPage,
    meta: {
      hideInMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/theater",
    name: "影院",
    component: TheaterPage,
  },
  {
    path: "/theater/:movieId",
    name: "影院查看",
    props: true,
    component: TheaterQueryPage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/theater/detail/:theaterId/:movieId",
    name: "影院详情页",
    props: true,
    component: TheaterDetailPage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/movie_order/:id",
    name: "订单生成页",
    props: true,
    component: AddMovieOrderPage,
    meta: {
      hideInMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/movie_order/detail/:id",
    name: "订单支付页",
    props: true,
    component: MovieOrderDetailPage,
    meta: {
      hideInMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/admin/movie_order",
    name: "订单管理页",
    props: true,
    component: AdminMovieOrderPage,
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/hot",
    name: "热点电影",
    component: HotMoviePage,
  },
  {
    path: "/add/movie",
    name: "创建电影",
    component: AddMoviePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/movie/:id",
    name: "修改电影",
    props: true,
    component: AddMoviePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
      hideInMenu: true,
    },
  },
  {
    path: "/admin/movie",
    name: "管理电影",
    component: AdminMoviePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/theater",
    name: "创建影院",
    component: AddTheaterPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/theater/:id",
    name: "修改影院",
    props: true,
    component: AddTheaterPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
      hideInMenu: true,
    },
  },
  {
    path: "/admin/theater",
    name: "管理影院",
    component: AdminMovieTheaterPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/movie_show",
    name: "创建上映",
    component: AddMovieShowPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/movie_show/:id",
    name: "修改上映",
    props: true,
    component: AddMovieShowPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
      hideInMenu: true,
    },
  },

  {
    path: "/admin/movie_show",
    name: "管理上映",
    component: AdminMovieShowPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/user",
    name: "创建用户",
    component: AddUserPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add/user/:id",
    name: "修改用户",
    props: true,
    component: AddUserPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
      hideInMenu: true,
    },
  },
  {
    path: "/admin/user",
    name: "管理用户",
    component: AdminUserPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/user",
    name: "用户",
    component: UserLayout,
    children: [
      {
        path: "/user/login",
        name: "用户登录",
        component: UserLoginPage,
      },
      {
        path: "/user/register",
        name: "用户注册",
        component: UserRegisterPage,
      },
    ],
    meta: {
      hideInMenu: true,
    },
  },
];
